-- suicide_attack
-- created by xinj
-- 每若干轮自动攻击

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 每回合触发
    trigger = function(who, prop, arg)
        local pos = who:getPos();
        local grid = DungeonM.getGridByPos(pos);
        local user = arg;

        local openRound = grid.openRound or 0;
        local curRound = CombatM.getRound();

        if curRound <= openRound or (curRound - openRound) % tonumber(prop[2]) ~= 0 then
            return false;
        end

        -- 直接施放自爆技能
        SkillM.apply(who, user, tonumber(prop[3]), curRound);

        return true;
    end,

    clear = function(who, prop)
        -- 同步清除掉改变技能间隔的属性
        PropM.deletePropById(who, "special", "add_cd");
    end,

    record = function(target, prop, path)
        return false;
    end
};
